<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\common\validate;

/**
 * 会员验证器
 */
class Department extends ValidateBase
{
    
    // 验证规则
    protected $rule = [
        'id'                => 'require',
        'name'              => 'require|unique:my_department',
        'address'           => 'require',
        'county_id'         => 'require',
        'town_id'           => 'require',
        'leader_code'       => 'require|number|length:18',
        'leader_name'       => 'require',
        'phone'             => 'require|length:7,11',
    ];

    // 验证提示
    protected $message = [
        'id.require'                => '请输入机构编号',
        'name.require'              => '请输入机构名称',
        'name.unique'               => '机构名称不能重复',
        'address.require'           => '请输入机构地址',
        'county_id.require'         => '请选择机构所属县区',
        'town_id.require'           => '请选择机构所属乡镇',
        'leader_code.require'       => '请输入负责人身份证号',
        'leader_code.number'        => '请输入负责人身份证号请输入数字',
        'leader_code.length'        => '负责人身份证号长度应为18位',
        'leader_name.require'       => '请输入负责人姓名',
        'phone.require'             => '请输入联系电话',
        'phone.length'              => '联系电话请输入7位或11位',
    ];

    // 应用场景
    protected $scene = [
        'add'       =>  ['id','name','county_id'],
        'edit'      =>  ['id','name','county_id'],
        'import'    =>  ['id','type','name'],
    ];
}
